import { INCREMENT, DECREMENT } from '../const.js'
import axios from 'axios'

const increment = (data) => ({ type: INCREMENT, payload: data })
const decrement = (data) => ({ type: DECREMENT, payload: data })
const asyncchange = (data) => {
    return async (dispatch) => {
        const { status } = await axios('http://localhost:3001/num');
        if (status === 200) {
            dispatch(increment(data))
        }
    }
}
export { increment, decrement, asyncchange }